package com.dream;

import com.dream.common.utils.SpringContextUtil;
import com.dream.common.utils.ThreadContextUtil;
import com.dream.common.utils.ThreadPoolService;
import com.dream.entity.RemindNextSenderBean;
import com.dream.service.DelayRelayQueue;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.web.client.RestTemplateBuilder;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.springframework.web.client.RestTemplate;
import tk.mybatis.spring.annotation.MapperScan;

import javax.annotation.Resource;

@EnableAsync
@MapperScan(basePackages="com.dream.mapper")
@EnableTransactionManagement
@EnableConfigurationProperties
@SpringBootApplication
public class DreamConsoleApplication  implements CommandLineRunner {
	public static void main(String[] args) {
		ConfigurableApplicationContext applicationContext = SpringApplication.run(DreamConsoleApplication.class, args);
		SpringContextUtil.setApplicationContext(applicationContext);


	}

	@Override
	public void run(String... args) throws Exception {
		System.out.println("Service Start Success!");

	}

	@Resource
	private RestTemplateBuilder restTemplateBuilder;

	@Bean
	public RestTemplate restTemplate() {
		return restTemplateBuilder.build();
	}
}
